package com.zm.demo.core.concurrent;

import org.junit.Test;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author zoum
 * @create 2019/12/25 11:29
 */
public class BlockedQueueTest {

    @Test
    public void test() throws Exception{
        ArrayBlockingQueue<Integer> arrayBlockingQueue = new ArrayBlockingQueue<Integer>(5);
        for (int i = 0; i < 10 ; i++) {
            if (i >= 5){
                arrayBlockingQueue.poll();
            }
            arrayBlockingQueue.put(i);

        }
    }
}
